<template>
  <div class="E-footer-control">
    <div class="wrap-btn wrap-btn-main">
      <span class="btn flex-center btn-left">
        <i class="fa fa-step-backward" />
      </span>
      <span class="btn flex-center btn-center" @click="play=!play">
        <i class="fa" :class="play?'fa-pause':'fa-play'" />
      </span>
      <span class="btn flex-center btn-right">
        <i class="fa fa-step-forward" />
      </span>
    </div>
    <div class="wrap-progress flex-center">
      <span class="time time-left">02:12</span>
      <el-slider v-model="progress_value" :max="1000" />
      <span class="time time-right">03:01</span>
    </div>
    <div class="wrap-volume flex-center">
      <span
        @click="volume_value=volume_value===0?50:0"
        :class="volume_value?(volume_value>50?'fa-volume-up':'fa-volume-down'):'fa-volume-off'"
        class="btn fa"
      />
      <el-slider v-model="volume_value" :max="100" />
    </div>
    <div class="wrap-btn wrap-btn-right">
      <!-- <el-tooltip effect="dark" content="歌词" placement="bottom" :open-delay="1000">
        <span class="btn fa fa-align-center" />
      </el-tooltip>-->
      <el-tooltip
        effect="dark"
        :content="`${play_rule.data[play_rule.cur].hint}`"
        placement="bottom"
        :open-delay="1000"
      >
        <span
          @click="cut_play_rule"
          :class="`${play_rule.data[play_rule.cur].icon}`"
          class="btn fa"
        />
      </el-tooltip>
      <el-tooltip effect="dark" content="播放列表" placement="bottom" :open-delay="1000">
        <span class="btn fa fa-list" />
      </el-tooltip>
      <el-tooltip effect="dark" content="下载" placement="bottom" :open-delay="1000">
        <span class="btn fa fa-download" />
      </el-tooltip>
      <el-tooltip effect="dark" content="分享" placement="bottom" :open-delay="1000">
        <span class="btn fa fa-share-square-o" />
      </el-tooltip>
    </div>
  </div>
</template>

<script>
import logo from '@/assets/logo.png';

export default {
  mounted() {
  },
  data() {
    return {
      play: false,
      play_rule: {
        cur: 0,
        data: [
          { hint: '循环播放', icon: 'fa-retweet' },
          { hint: '随机播放', icon: 'fa-random' },
          { hint: '顺序播放', icon: 'fa-indent' }
        ]
      },
      progress_value: 0,
      volume_value: 0
    };
  },
  watch: {
    progress_value(val) {
      console.log(val);
    }
  },
  methods: {
    cut_play_rule() {
      let { cur } = this.play_rule;
      cur += 1;
      this.play_rule.cur = this.play_rule.data[cur] ? cur : 0;
    }
  }
};
</script>

<style lang="scss">
.E-footer-control {
  $h: 50px;
  cursor: default;
  display: flex;
  align-items: center;
  height: $h;
  & > .wrap-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    height: $h;
    &.wrap-btn-main {
      width: 200px;
      & > .btn {
        background: rgb(232, 60, 60);
        width: 30px;
        height: 30px;
        border-radius: 50%;
        margin: 0 12px;
        color: #fff;
        cursor: pointer;
        transition: background-color 0.5s;
        font-size: 16px;
        &:hover {
          background: rgb(211, 48, 48);
        }
        &.btn-center {
          transform: scale(1.2);
          & > i.fa-play:before {
            margin-right: -3px;
          }
        }
      }
    }
    &.wrap-btn-right {
      // background: rgba(255, 0, 0, 0.2);
      & > .btn {
        display: inline-block;
        text-align: center;
        width: 25px;
        margin-left: 15px;
        font-size: 18px;
        cursor: pointer;
        &:last-of-type {
          margin-right: 15px;
        }
        &:hover {
          color: #000;
        }
      }
    }
  }
  & > .wrap-progress {
    height: $h;
    flex-grow: 1;
    & > .time {
      width: 60px;
      flex: 0 0 60px;
      text-align: center;
    }
    & > .el-slider {
      flex-grow: 1;
      & > .el-slider__runway {
        & > .el-slider__bar {
          background-color: #f68181;
        }
        & > .el-slider__button-wrapper {
          & > .el-slider__button {
            border-width: 5px;
            border-color: #f36c6c;
          }
        }
      }
    }
  }
  & > .wrap-volume {
    height: $h;
    width: 150px;
    & > .btn {
      width: 30px;
      flex: 0 0 30px;
      text-align: center;
      cursor: pointer;
      &:hover {
        color: #000;
      }
    }
    & > .el-slider {
      flex-grow: 1;
      padding-right: 10px;
      & > .el-slider__runway {
        $bar_size: 5px;
        height: $bar_size;
        &:hover {
          & > .el-slider__button-wrapper {
            display: block;
          }
        }
        & > .el-slider__bar {
          height: $bar_size;
          background-color: #409eff;
          border-radius: $bar_size;
        }
        & > .el-slider__button-wrapper {
          display: none;
          & > .el-slider__button {
            border-width: $bar_size * 0.8;
            width: $bar_size * 2.5;
            height: $bar_size * 2.5;
            border-color: #409eff;
          }
        }
      }
    }
  }
}
</style>
